package com.iplant.ams.service.po.dms.maintenance;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

/**
 * 保养规则
 *
 * @author YouWang·Peng
 * 2022-8-8 09:20:21
 */
@DBBasePO(TableName = "dms_maintenance_rule", Schemas = DBSchemas.AMS, CheckName = {"Code"}, CodeAuto = true,
        CodePrefix = "DMR-", Name = false)
public class DMSMaintenanceRule extends BasePO implements Serializable {
    private static final long serialVersionUID = 1L;



    /**
     * 构型名称
     **/
    @DBCondition
    @DBJoin(name = "DeviceID", tableName = "dms_configuration", tableAsName = "dms_configuration1", Schemas =
            DBSchemas.AMS,
            MainTableField = "ConfigurationID")
    public int DeviceID = 0;

    /**
     * 构型ID
     **/
    @DBCondition
    @DBField
    public int ConfigurationID = 0;
    /**
     * 构型名称
     **/
    @DBJoin(name = "Name", tableName = "dms_configuration", tableAsName = "dms_configuration1", Schemas =
            DBSchemas.AMS,
            MainTableField = "ConfigurationID")
    public String ConfigurationName = "";

    @DBJoin(name = "Code", tableName = "dms_configuration", tableAsName = "dms_configuration1", Schemas =
            DBSchemas.AMS,
            MainTableField = "ConfigurationID")
    public String ConfigurationCode = "";

    /**
     * 类型：次数或周期
     **/
    @DBCondition
    @DBField
    public int Type = 0;
    /**
     * 次数或时间(天)
     **/
    @DBField
    public int Times = 0;

    /**
     * 生效时间
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.le)
    @DBField
    public Calendar EffectiveTime = Calendar.getInstance();

    /**
     * 下次作业时间
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.ge)
    @DBField
    public Calendar NextWorkTime = Calendar.getInstance();

    /**
     * 保养项列表
     **/
    public List<DMSMaintenanceItem> MaintenanceItemList = new ArrayList<>();

    @JsonProperty("ConfigurationID")
    public int getConfigurationID() {
        return ConfigurationID;
    }

    public void setConfigurationID(int configurationID) {
        ConfigurationID = configurationID;
    }

    @JsonProperty("ConfigurationName")
    public String getConfigurationName() {
        return ConfigurationName;
    }

    public void setConfigurationName(String configurationName) {
        ConfigurationName = configurationName;
    }

    @JsonProperty("ConfigurationCode")
    public String getConfigurationCode() {
        return ConfigurationCode;
    }

    public void setConfigurationCode(String configurationCode) {
        ConfigurationCode = configurationCode;
    }

    @JsonProperty("Type")
    public int getType() {
        return Type;
    }

    public void setType(int type) {
        Type = type;
    }

    @JsonProperty("Times")
    public int getTimes() {
        return Times;
    }

    public void setTimes(int times) {
        Times = times;
    }

    @JsonProperty("MaintenanceItemList")
    public List<DMSMaintenanceItem> getMaintenanceItemList() {
        return MaintenanceItemList;
    }

    public void setMaintenanceItemList(List<DMSMaintenanceItem> maintenanceItemList) {
        MaintenanceItemList = maintenanceItemList;
    }

    @JsonProperty("EffectiveTime")
    public Calendar getEffectiveTime() {
        return EffectiveTime;
    }

    public void setEffectiveTime(Calendar effectiveTime) {
        EffectiveTime = effectiveTime;
    }

    @JsonProperty("NextWorkTime")
    public Calendar getNextWorkTime() {
        return NextWorkTime;
    }

    public void setNextWorkTime(Calendar nextWorkTime) {
        NextWorkTime = nextWorkTime;
    }
    @JsonProperty("DeviceID")
    public int getDeviceID() {
        return DeviceID;
    }

    public void setDeviceID(int deviceID) {
        DeviceID = deviceID;
    }
}
